package com.cham.schedule.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author Howl-Xu
 * @version 1.0.0
 * @Description: 请描述一下这个类文件吧
 * @createTime 2020年03月18日 23:27:00
 */
public interface VideoMapper {

    @Update("update\n" +
            "\tcham_video\n" +
            "set\n" +
            "\tcreate_date = curtime()\n" +
            "where\n" +
            "\tvideo_id in (\n" +
            "\tselect\n" +
            "\t\tvideo.video_id\n" +
            "\tfrom\n" +
            "\t\t(\n" +
            "\t\tselect\n" +
            "\t\t\tcv.video_id\n" +
            "\t\tfrom\n" +
            "\t\t\tcham_video cv,\n" +
            "\t\t\tcham_video_append_info cvai,\n" +
            "\t\t\tcham_video_fenqu cvf\n" +
            "\t\twhere\n" +
            "\t\t\tcv.video_id = cvai.video_id\n" +
            "\t\t\tand cv.video_id = cvf.video_id\n" +
            "\t\t\tand cvf.fenqu_parent = #{fenquParent}\n" +
            "\t\torder by\n" +
            "\t\t\tcvai.video_bofang desc\n" +
            "\t\tlimit 10)as video )")
    void updateVideoInfoTop10DateToTodayByFenquParent(@Param("fenquParent") String fenquParent);

    @Update("update\n" +
            "\tcham_video\n" +
            "set\n" +
            "\tcreate_date = curtime()\n" +
            "where\n" +
            "\tvideo_id in (\n" +
            "\tselect\n" +
            "\t\tvideo.video_id\n" +
            "\tfrom\n" +
            "\t\t(\n" +
            "\t\tselect\n" +
            "\t\t\tcv.video_id\n" +
            "\t\tfrom\n" +
            "\t\t\tcham_video cv,\n" +
            "\t\t\tcham_video_append_info cvai,\n" +
            "\t\t\tcham_video_fenqu cvf\n" +
            "\t\twhere\n" +
            "\t\t\tcv.video_id = cvai.video_id\n" +
            "\t\t\tand cv.video_id = cvf.video_id\n" +
            "\t\torder by\n" +
            "\t\t\tcvai.video_bofang desc\n" +
            "\t\tlimit 10)as video )")
    void updateVideoInfoTop10DateToToday();
}
